﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Caching;

namespace CitizenDiary.Sync.Shared
{
    public interface ICache
    {
        string Get(string key);

        void Set(string key, string value);

        void Remove(string key);
    }

    public class InProcCache : ICache
    {
        public string Get(string key)
        {
            return (string)MemoryCache.Default.Get(key);
        }

        public void Set(string key, string value)
        {
            MemoryCache.Default.Set(key, value, DateTimeOffset.Now.AddMinutes(3));
        }

        public void Remove(string key)
        {
            MemoryCache.Default.Remove(key);
        }
    }
}
